#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time   : 2023-05-26 16:19:04
# @Author : 搬砖客
import os
from common.path_setting import ensure_path_sep


def del_file(path):
    """删除目录下的文件"""
    if os.path.exists(path):
        list_path = os.listdir(path)
        for i in list_path:
            c_path = os.path.join(path, i)
            if os.path.isdir(c_path):
                del_file(c_path)
            else:
                os.remove(c_path)


def del_report_file():
    del_file((ensure_path_sep("\\allure-report")))
    del_file((ensure_path_sep("\\allure-results")))
    del_file((ensure_path_sep("\\report")))
    del_file((ensure_path_sep("\\temps")))
    print("删除报告文件成功")


def del_logs_file():
    del_file((ensure_path_sep("\\logs")))
    print("删除日志文件成功")


if __name__ == '__main__':
    del_report_file()
    del_logs_file()
    pass
